package com.nf.health.app.AfinalDb;

import com.nf.health.app.bodyfat.bean.BodyFatInfo;
import com.nf.health.app.sweat.bean.SweatBean;

import java.util.List;

/**
 * Created by hepann on 2016/11/9.
 * The only genius that is worth anything is the genius for hard work
 *
 * @author hepann
 * @Description 存储测量数据的dao 提供crud操作
 * @email he_pann@163.com
 */

public class MeasureDataDao {
    /**
     * 体脂称相关
     * 存储,查找,删除
     */
    public static void saveBodyFatBean(BodyFatInfo info) {
        AfinalDb.getDb().save(info);
    }

    public static List<BodyFatInfo> getAllBodyFat() {
        List<BodyFatInfo> list = AfinalDb.getDb().findAll(BodyFatInfo.class);
        return list;
    }

    public static void deleteBodyFatById(int id) {
        AfinalDb.getDb().deleteById(BodyFatInfo.class, id);
    }

    /**
     * 汗液相关
     * 存储,查找,删除
     */
    public static void saveSweatBean(SweatBean info) {
        AfinalDb.getDb().save(info);
    }

    public static List<SweatBean> getAllSweat() {
        List<SweatBean> list = AfinalDb.getDb().findAll(SweatBean.class);
        return list;
    }

    public static void deleteSweatById(int id) {
        AfinalDb.getDb().deleteById(SweatBean.class, id);
    }
}
